package com.isea.pomodoro;

/**
 * 生成时间字符串
 * 
 * @author liuzh
 *
 */
public class TimeUtil {
	
	public static void main(String[] args) {
		System.out.println(getTime(100));
	}
	
	/**
	 * 根据秒数返回时间字符串
	 * @param seconds
	 * @return
	 */
	public static String getTime(int seconds){
		if(seconds<0){
			return null;
		}
		int mi = seconds/60;
		int sec = seconds%60;
		String time = "";
		if(mi==0){
			time += "00";
		}
		else if(mi>0&&mi<10){
			time += "0"+mi;
		}
		else {
			time += mi;
		}
		time += ":";
		if(sec==0){
			time += "00";
		}
		else if(sec>0&&sec<10){
			time += "0"+sec;
		}
		else {
			time += sec;
		}
		return time;
	}
}
